package com.bigdata;



import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import redis.clients.jedis.HostAndPort;
import redis.clients.jedis.JedisCluster;
import redis.clients.jedis.JedisPoolConfig;

import java.util.HashSet;
import java.util.Set;


@SpringBootApplication
public class GuavacacheApplication {

    public static void main(String[] args) {
        SpringApplication.run(GuavacacheApplication.class, args);
    }
    @Bean
    public JedisCluster getJedisCluster() {
        JedisPoolConfig config = new JedisPoolConfig();
        Set<HostAndPort> jedisClusterNode = new HashSet<HostAndPort>();

        jedisClusterNode.add(new HostAndPort("192.168.1.105", 7001));
        jedisClusterNode.add(new HostAndPort("192.168.1.105", 7002));
        jedisClusterNode.add(new HostAndPort("192.168.1.105", 7003));
        jedisClusterNode.add(new HostAndPort("192.168.1.105", 7004));
        jedisClusterNode.add(new HostAndPort("192.168.1.105", 7005));
        jedisClusterNode.add(new HostAndPort("192.168.1.105", 7006));
        jedisClusterNode.add(new HostAndPort("192.168.1.105", 7007));
        jedisClusterNode.add(new HostAndPort("192.168.1.105", 7008));
        JedisCluster jcd = new JedisCluster(jedisClusterNode, config);
        return jcd;

    }

}
